home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
- #include <gemdefs.h>
- #include <osbind.h>
-
- #define Cprnout(a) gemdos(0x5,a) /* Schickt ein Zeichens an Drucker */
- #define prt_ready() gemdos(0x11) /* Prüft ob Drucker bereit ist */
-
- int ap_id;
- int menu_id;
-
- extern int gl_apid;
-
-
- pruefe_drucker()
- {
- while (!prt_ready())
- form_alert(1,"[3][Schalten Sie den Drucker ON LINE! ][OK]");
- }
-
-
- vorschub()
- { /* Erzeugt einen doppelten Zeilenvorschub */
- Cprnout(13);
- Cprnout(10);
- Cprnout(13);
- Cprnout(10);
- }
-
-
-
- drucke_etiketten()
- {
- int merke_blank,c,i,
- st_vorname = 1,
- st_strasse = 1,
- st_plz = 1,
- st_wohnort = 1;
- int pressed_button;
-
- FILE *fopen(), *fp;
-
- if ((fp = fopen("ADRESSEN.RPT","r")) == NULL) /* existiert die Datei? */
- form_alert(1,"[3][Ich kann die Datei ADRESSEN.RPT nicht finden][OK]");
- else
- {
- pressed_button=form_alert(1,"[1][Drucker vorbereiten][weiter|Abbruch]");
-
- if (pressed_button == 1 ) /* Benutzer hat "weiter" angeklickt */
- {
- pruefe_drucker(); /* Ist Drucker wirklich bereit? */
-
- /* Suche anhand der Reporttitelzeile nach den Spalten in denen */
- /* Vorname, Straße und PLZ beginnen: */
-
- while ((( c = getc(fp)) != EOF) && (c != 10 )); /* Skip first Line */
- while ((( c = getc(fp)) != EOF) && (c <= 32 )); /* Skip Blanks&CRTS */
- /* lese bis zum Doppelpunkt: */
- while ((( c = getc(fp)) != EOF) && (c != 58 )) st_vorname++;
- /* Überlese nachfolgende Blanks: */
- while ((( c = getc(fp)) != EOF) && (c <= 32 )) st_vorname++;
- st_strasse = st_vorname;
- /* Suche ebenso die Spalten fuer Straße und PLZ */
- while ((( c = getc(fp)) != EOF) && (c != 58 )) st_strasse++;
- while ((( c = getc(fp)) != EOF) && (c <= 32 )) st_strasse++;
- st_plz = st_strasse;
- while ((( c = getc(fp)) != EOF) && (c != 58 )) st_plz++;
- while ((( c = getc(fp)) != EOF) && (c <= 32 )) st_plz++;
- st_wohnort = st_plz;
- while ((( c = getc(fp)) != EOF) && (c != 58 )) st_wohnort++;
- while ((( c = getc(fp)) != EOF) && (c <= 32 )) st_wohnort++;
-
- while ((( c = getc(fp)) != EOF) && (c != 10) ); /* skip bis Zeilenende */
- while (c != EOF)
- {
-
- while ((( c = getc(fp)) != EOF) && (c <= 32 )); /* Skip Blanks&CRTS */
-
- /* Drucke Name und Vorname durch höchstens */
- /* ein Leerzeichen getrennt: */
- if (c >32) Cprnout(c);
- i = 0;
- merke_blank=c;
- while (((c = getc(fp)) !=EOF) && ( i++ <= st_strasse ) )
- {
- if((merke_blank == 32) && (c == 32));
- else Cprnout(c);
- merke_blank = c;
- }
- Cprnout(c);
-
- vorschub();
-
- /* Drucke Straße : */
-
- while (((c = getc(fp)) !=EOF)&& (i++ <= st_plz) ) Cprnout(c);
- Cprnout(c);
-
- vorschub();
- /* Drucke PLZ und Wohnort: */
-
- while ((( c = getc(fp)) != EOF) && (c <= 32 ));
- Cprnout(c);
- while ((( c = getc(fp)) != EOF) && (c != 10) ) Cprnout(c);
-
- vorschub();
- }
- }
- }
- } /* drucke_etiketten*/
-
-
- main()
- {
- int Mitteilung[8];
-
- ap_id = appl_init(); /* Mache das Programm dem AES bekannt */
-
- menu_id = menu_register(gl_apid, " Etiketten");
- /* Erzeuge Eintrag im DESK Menu */
-
- while(1==1) /* fuer immer: */
- {
- evnt_mesag(Mitteilung); /* Warte auf Mitteilung vom AES */
-
- wind_update(BEG_UPDATE); /* Bildschirm sperren */
-
- if(Mitteilung[0]==AC_OPEN && Mitteilung[4]==menu_id) /* falls */
- drucke_etiketten(); /* das Accessory angeklickt wurde: */
- /* starte Druckprogramm */
-
- wind_update(END_UPDATE); /* Bildschirm freigeben */
- }
- } /* main */
-